package com.liuguangaop.controller;

import com.alibaba.fastjson.JSONObject;
import com.liuguangaop.exception.MyException;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

/**
 * @ClassName: TestAopController
 * @Description：
 * @Author: wanghr
 * Date: 10:35 AM 2020/7/9
 * Version: 1.0
 */
@Slf4j
@RestController
@RequestMapping("/aop")
public class TestAopController {

    private Integer num = 1;

    @InitBinder
    public void initBinder() {
        num = num+1;
    }
    @RequestMapping(value = "/testaop",method = RequestMethod.POST)
    public String testaop(@RequestBody JSONObject jsonStr) {
        log.info("进入方法：{}",jsonStr);
        System.out.println("测试InitBinder是否生效"+num);
//        throw new MyException("自定义的异常啊  ！！！！！");
        return "返回值!!!!!!";
    }
}
